

class ConfigTable {
    // 初始化
    init = (modelName, actionName) => {
        this.modelName = modelName;
        this.actionName = actionName;
    }

    // 修改值前  返回true继续执行
    beforeChangeValue = () => {
        return true;
    }

    // 修改值
    changeTableValue = (key, index) => {
        const model = this.models[this.modelName];
        
        return (e) => {
            if (this.beforeChangeValue(key, index)) {
                const value = e.target ? e.target.value : e;
                model.set({
                    [`data[${index}].${key}`]: value 
                });
    
                this.afterChangeValue(key, index);
            }
        }
    }

    // 修改值后出发
    afterChangeValue = (key, index) => {

    }
    
    // 输入框聚焦
    onFocus = (key, index) => {

    }

    // 渲染前再次处理columns
    processColumns = (model) => {
        return model.columns;
    }
    
    // 渲染前再次处理表格数据
    processData = (model) => {
        return model.data;
    }

    // 渲染单元格
    renderCell = () => {
        
    }
}

export default ConfigTable;